home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiscKit1.7.1 / MiscKitArchive.mbox / mbox / 000221_misckit-reques…aska.et.byu.edu_Mon Jun 13 08:27:55 1994.msg < prev    next >
Internet Message Format  |  1994-10-30  |  8KB

  1. Return-Path: <misckit-request@alaska.et.byu.edu>
  2. Received: from alaska.et.byu.edu by darth.byu.edu (NX5.67d/NX3.0M)
  3.     id AA00421; Mon, 13 Jun 94 08:27:41 -0600
  4. Received: from yvax1.byu.edu by alaska.et.byu.edu; Mon, 13 Jun 1994 02:44:32 -0600
  5. Received: from DIRECTORY-DAEMON by yvax.byu.edu (PMDF V4.3-8 #7277)
  6.  id <01HDH7LYB2CG9I49WI@yvax.byu.edu>; Mon, 13 Jun 1994 02:43:59 MDT
  7. Received: from alaska.et.byu.edu by yvax.byu.edu (PMDF V4.3-8 #7277)
  8.  id <01HDH7LUPKDC8Y5YYH@yvax.byu.edu>; Mon, 13 Jun 1994 02:43:54 -0600 (MDT)
  9. Received: from yvax1.byu.edu by alaska.et.byu.edu; Mon,
  10.  13 Jun 1994 02:41:46 -0600
  11. Received: from DIRECTORY-DAEMON by yvax.byu.edu (PMDF V4.3-8 #7277)
  12.  id <01HDH7IGB75C9I49WI@yvax.byu.edu>; Mon, 13 Jun 1994 02:41:10 MDT
  13. Received: from fsa.cpsc.ucalgary.ca by yvax.byu.edu (PMDF V4.3-8 #7277)
  14.  id <01HDH7ICOM5C01FFJ5@yvax.byu.edu>; Mon, 13 Jun 1994 02:41:05 -0600 (MDT)
  15. Received: from news.cpsc.ucalgary.ca (news.cpsc.ucalgary.ca [136.159.3.2])
  16.  by fsa.cpsc.ucalgary.ca (1.6) id <CAA01119@fsa.cpsc.ucalgary.ca>; Mon,
  17.  13 Jun 1994 02:38:37 -0600
  18. Received: by news.cpsc.ucalgary.ca (1.2; from uucp@localhost)
  19.  id <CAA27015@news.cpsc.ucalgary.ca>; Mon, 13 Jun 1994 02:38:35 -0600
  20. Received: from avocado.cuc.ab.ca by ajfcal.cuc.ab.ca (5.65c/Cuc2.2)
  21.  id AA16413; Mon, 13 Jun 1994 00:51:34 -0600
  22. Received: by avocado.cuc.ab.ca id AA10563
  23.  (5.65c#3#/IDA-1.4.4 for hsr@CS.Stanford.EDU); Mon, 13 Jun 1994 00:01:02 -0600
  24. Received: by NeXT.Mailer (1.100)
  25. Received: by NeXT Mailer (1.100)
  26. Date: Mon, 13 Jun 1994 00:01:02 -0600
  27. From: "R. Todd Thomas" <todd@avocado.cuc.ab.ca>
  28. Subject: Interfaces for MiscGraphNode, MiscFile and MiscIconFile (Long)
  29. To: misckit@byu.edu
  30. Cc: hsr@cs.stanford.edu
  31. Message-Id: <199406130601.AA10563@avocado.cuc.ab.ca>
  32. Content-Transfer-Encoding: 7BIT
  33.  
  34.  
  35.  
  36. Hi All,
  37.  
  38. I'd like to thank everyone that made suggestions, etc that went into making these interfaces, and Scott Roy for making the IconKit, where much of the design ideas for these classes came from.
  39.  
  40. Check them out and let me know what you think....
  41.  
  42. Summary:
  43.     Proposal for interfaces for a generic File class.
  44.  
  45. MiscGraphNode:    Represents a node in a directed graph. Keeps track of parents, children
  46.                 and dependancies. Conforms to IKDependancy (from IconKit)
  47. MiscFile:            Represents a path in the filesystem. Very bare-bones right now.
  48. MiscIconFile:        Contains everything needed  for dragging/dropping MiscFiles. Conforms to
  49.                 IKIconObject.
  50.  
  51.  
  52. /************************************************************************
  53.   CLASS:                MiscGraphNode
  54.   INHERITS FROM:    Object
  55.  
  56.  This class represents a node in a directed graph. Anyone familiar with Scott Roy's IconKit will recognize most of the methods this class uses. Since so much of the content (interface and protocols) of this object comes from the IconKit, I would definitely suggest you take a look at it. It can be found on cs.orst.edu in /pub/next/sources/objects.
  57.  
  58.  The object takes care of it's own garbage collection by freeing itself when it no longer has any parents or users (see IKAnnouncer in IconKit). The list of parents is kept only for garbage collection and easy traversal of the graph in both directions.
  59.  
  60.  Announcements (which is a little like delegation) are controlled by the announcer object (which also is part of the IconKit).
  61.    
  62.  *************************************************************************/
  63.  
  64. @interface MiscGraphNode: Object <IKDependancy>
  65. {
  66.     id  children;            // list of node's children
  67.     id  parents;            // list of node's parents
  68.     id  announcer;            // announcer object used for keeping track of                         // dependancies (see IKAnnouncer in IconKit)
  69.     BOOL  parentsLoaded,
  70.           childrenLoaded;    // already loaded the node's parents or children?
  71. }
  72.  
  73. - init;
  74. - free;
  75.  
  76. - (BOOL)isLeaf;
  77. - setLeaf: (BOOL)isLeaf;
  78.  
  79. // methods for child maniplulation
  80.  
  81. - children;
  82. - addChild: aChild;
  83. - addChildren: theChildren;
  84. - removeChild: aChild;
  85. - removeChildren: theChildren;
  86. - (BOOL)childrenLoaded;
  87.  
  88. // methods for parent manipulation
  89.  
  90. - parents;
  91. - addParent: aParent;
  92. - removeParent: aParent;
  93. - (BOOL)parentsLoaded;
  94.  
  95. // methods for searching through the graph
  96.  
  97. - pathFromNode: source;
  98. - pathToNode: destination;
  99. - searchFor: goal via: (SEL)getNext;
  100.  
  101. // methods for garbage collection
  102.  
  103. - checkForFree;
  104. - (BOOL)garbageCollect;
  105.  
  106. // methods for keeping track of dependancies between nodes and other objects
  107. // these are from the IKDependency protocol
  108.  
  109. - addUser: aUser;
  110. - removeUser: aUser;
  111. - addListener: aListener;
  112. - removeListener: aListener;
  113.  
  114. // Archiving
  115.  
  116. - read: (NXTypedStream *)stream;
  117. - write: (NXTypedStream *)stream;
  118.  
  119. @end
  120.  
  121.  
  122.  
  123. // These notifications will be sent to any users and/or listeners that
  124. // are registered with the MiscGraphNode's announcer.
  125.  
  126. @interface Object (MiscGraphNodeNotification)
  127.  
  128. - didAddChild: theObject;
  129. - didAddChildren: theObject;
  130. - didAddParent: theObject;
  131. - didRemoveChild: theObject;
  132. - didRemoveChildren: theObject;
  133. - didRemoveParent: theObject;
  134. - willFree: theObject;
  135.  
  136. @end
  137.  
  138.  
  139.  
  140.  
  141. /************************************************************************
  142.   CLASS:                MiscFile
  143.   INHERITS FROM:    MiscGraphNode
  144.  
  145.     The MiscFile just adds enough to MiscGraphNode to represent a  file.
  146.   
  147.  *************************************************************************/
  148.  
  149. @interface MiscFile : MiscGraphNode
  150. {
  151.     char  *path;
  152. }
  153.  
  154. // exists so that classes can create children of another class
  155. + setDefaultFileClass: classId;
  156. // exists so that a class can create children of different subclasses depending upon the file's
  157. // extension.
  158. + registerFileClass: classId forExtension: (const char *)extension;
  159.  
  160. - initWithPath: (const char *)fullPath;
  161. - initWithName: (const char *)filename inDirectory: (const char *)directory;
  162.  
  163. - (const char *)filename;
  164. - (const char *)fullPath;
  165.  
  166. // Overriden methods from MiscGraphNode. Needed so different children can
  167. // be of different classes. (See +setDefaultFileClass: and
  168. // +registerFileClass:forExtension).
  169.  
  170. - children;
  171. - parents;
  172.  
  173. @end
  174.  
  175. // whatabout all the other attributes? permissions, size, etc.
  176. // perhaps a category?
  177.  
  178. // what about file changes like -renameTo: -remove ,etc
  179. // another category?
  180.  
  181. // Any ideas of what should absolutely be included in this class that would not fit better in a category?
  182.  
  183. @end
  184.  
  185.  
  186.  
  187.  
  188. /************************************************************************
  189.  * CLASS:            MiscIconFile
  190.  * INHERITS FROM:    MiscFile
  191.  *
  192.  *    Adds to MiscFile the methods necessary to support a MiscFile that can
  193.  * be dragged, dropped, and displayed. This class uses protocols that
  194.  * were originally designed for the IconKit. Saved me a lot of work!
  195.  *
  196.  *************************************************************************/
  197.  
  198. @interface MiscIconFile: MiscFile  <IKIconObject>
  199. {
  200.     id  image;                    // icon that represents the file
  201.     id  acceptingDragImage;        // image to display when the folder opens                
  202.     BOOL  draggable,             // is the File draggable?
  203.           dragAccepting,         // does the file accept drags?
  204.           editable,             // is the name of the folder editable?
  205.           hidden,                 // should the folder show up in a browser?
  206.           displayAsLeaf;        // display as a leaf?
  207. }
  208.  
  209. + initialize;
  210. - init
  211. - free;
  212.  
  213. - (const char *)name;
  214. - (NXImage *)image;
  215. - setName: (const char *)newName;
  216. - setImage: (NXImage *)newImage;
  217.  
  218. + (NXAtom *)pastetypes;
  219. + readFromPasteboard: (Pasteboard *)pboard;
  220. - copyToPasteboard: (Pasteboard *)pboard;
  221.  
  222. - setAcceptingDragImage: (NXImage *)anImage;
  223. - acceptingDragImage;
  224.  
  225. - (BOOL)isEditable;
  226. - (BOOL)isDraggable;
  227. - (BOOL)isDragAccepting;
  228. - (BOOL)isHidden;
  229. - setEditable: (BOOL)aBool;
  230. - setDraggable: (BOOL)aBool;
  231. - setDragAccepting: (BOOL)aBool;
  232. - setHidden: (BOOL)aBool;
  233.  
  234. - (NXDragOperation)draggingEntered: (id <NXDraggingInfo>)sender;
  235. - draggingUpdated: (id <NXDraggingInfo>)sender;
  236. - draggingOperation: (id <NXDraggingInfo>)sender;
  237. - (BOOL)performDragOperation: (id <NXDraggingInfo>)sender;
  238.  
  239. @end
  240.  
  241.  
  242. // Notifications sent out to users and listeners that are registered with the announcer object in MiscGraphNode.
  243.  
  244. @interface Object (MiscIconFileNotification)
  245.  
  246. - didChangeName: sender;
  247. - didChangeImage: sender;
  248. - didChangeAcceptingDragImage: sender;
  249. - didChangeProperties: sender;
  250.  
  251. @end
  252.  
  253.  
  254.  
  255. Todd Thomas
  256. todd@avocado.cuc.ab.ca        [NeXTMail]
  257.  
  258.  
  259.